package edu.guigu.networkdemomvvm.common;

import android.widget.ImageView;

import androidx.databinding.BindingAdapter;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;

public class ImageAdapter {

    @BindingAdapter("android:avatar")
    public static void setAvatar(ImageView imageView, String url) {
        Glide.with(imageView.getContext())
                .load(url)
                .apply(new RequestOptions().transform(new RoundedCorners(16)))
                .into(imageView);
    }
}
